import { WPSRequest } from "../../wps2/WPSRequest";
import { WPSContext } from "../../wps2/WPSContext";
const appId: string | undefined = process.env.appId;
const appKey: string | undefined = process.env.appKey;
let request = new WPSRequest(
  new WPSContext("https://t5.wpseco.cn/", appId, appKey)
);
export class YundocApi {
  //获取根部门
  apiDepartment() {
    return request.get("/org/dev/v1/companies/1/depts/root");
  }
  //获取子部门列表
  apiBranch(id: string | number) {
    return request.get(
      `/org/dev/v1/companies/1/depts/${id}/depts?offset=0&limit=100`
    );
  }
  //新增子部门
  apiNewBranch(id: number | string, params: object) {
    return request.post(`/org/dev/v1/companies/1/depts/${id}`, params);
  }
  //创建企业用户
  createUser(params: object) {
    return request.post("/org/dev/v1/companies/1/members", params);
  }
  //添加账户到部门
  addAccount(id: number, account_id: number, params: object) {
    return request.post(
      `/org/dev/v1/companies/1/depts/${id}/members/${account_id}`,
      params
    );
  }
  //启用企业成员
  enterpriseMembers(params: object) {
    return request.post(`/org/dev/v1/batch/companies/1/members/enable`, params);
  }
}
